<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>

<body>

  <div id="app">

    <input type="text" v-focus name="" id="">

    <h1 v-style="{'fontSize':'35px',color:'red'}">太原2003</h1>

  </div>
  <script>


    Vue.directive('focus', {
      inserted: function (el) {
        console.log(el)
        el.focus()
      }
    })

    Vue.directive('style',{
      bind:function(el,params){
        let [fontSize,color] = Object.keys(params.value)
        el.style[fontSize]=params.value[fontSize]
        el.style[color]=params.value[color]
        console.log(arguments)
      }
    })


    var vm = new Vue({
      el: "#app",
      data: {
        name: 'xiaoming'
      }
    })
  </script>

</body>

</html>